<%
# View which displays a single group's information.  
#
# Author::      Eli Fox-Epstein, efoxepstein@wesleyan.edu
# Author::      Dimitar Gochev, dimitar.gochev@trincoll.edu
# Copyright::   Humanitarian FOSS Project (http://www.hfoss.org), Copyright (C) 2009.
# License::     http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL)
%>

<% content_for :title, title(@group.name, 'Groups', @instance.short_name)%>

<% content_for :body do %>
		<%= pretty_button_if(@group.updatable_by?(@current_user), :edit_group, edit_instance_group_type_group_path(@instance, @group.group_type, @group), 'Edit Group') %>
		<%= pretty_delete_button(@group, :check => true)%>
		<%= pretty_button_if (!@group.users.include? @current_user), :join_group, instance_memberships_path(@instance, :group_id => @group.id, :user_id => @current_user), 'Join Group', :method => :post %>
		<%= pretty_button_if (@group.users.include? @current_user), :join_group, instance_memberships_path(@instance, :group_id => @group.id, :user_id => @current_user, :leave => 'true'), 'Leave Group', :method => :post %>
	<%= flashes %>
	<div id="wrap">
	<h1><%= @group.name %> <span class='subtitle'>&laquo; <%= @group.class.name.titleize %> </span></h1>
		<% unless @group.users.empty? %>
			<h2>Group users:</h2>
			<ul>
				<% @group.users.each do |u| %>
					<li><%= link_to u.full_name, instance_user_url(@instance, u) %></li>
				<% end %>
			</ul>
		<% end %>
	</div>
<% end %>
